package cool.taomu.box.spi

import javax.inject.Inject
import cool.taomu.box.guice.ann.Binder

interface ISpiTest {
	def void print();
}

class SpiImpl1 implements ISpiTest {

	override print() {
		println("SpiImp1")
	}

}

@Deprecated
@Binder(bind=SpiImpl2_1)
class SpiImpl2 implements ISpiTest {

	@Inject
	SpiImpl2_1 instance;
	
	override print() {
		println("SpiImp2")
		instance.print();
	}
}

class SpiImpl2_1 {
	def print(){
		println("SpiImp2_1")
	}
}


class SpiTestMain {
	def static void main(String[] args) {
		var TaomuServiceLoader<ISpiTest> tsl = new TaomuServiceLoader(ISpiTest);
		tsl.all.forEach [
			it.print()
		]
	}
}
